<template>
  <div class="hearder">
    <div class="hearders">
      <el-avatar
        style="margin-right: 20px"
        src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
      />
      <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link" style="margin: 0px 20px 0 10px">
          Jack
          <el-icon class="el-icon--right">
            <arrow-down />
          </el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item command="a">注销并退出</el-dropdown-item>
            <el-dropdown-item command="b">设置</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
      <el-icon><Bell /></el-icon>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { Bell, ArrowDown } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'
import { ref } from 'vue'
const router = useRouter()
const handleCommand = (command: string) => {
  if (command === 'a') {
    router.push('/login')
  } else if (command === 'b') {
    console.log('设置')
  }
}
</script>

<style lang="scss" scoped>
.hearder {
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  width: 100%;
  height: 50px;
  background-color: #fff;
  display: flex;
  border-bottom: 1px solid #fff;
  .hearders {
    width: 100%;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
  }
}
</style>
